<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'myselfManage.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	 <link rel="stylesheet" type="text/css" href="jsTools/bootstrap-3.3.7-dist/css/bootstrap.min.css">
	<script type="text/javascript" src="jsTools/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	
	<link rel="stylesheet" type="text/css" href="jsTools/jquery-easyui-1.5.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="jsTools/jquery-easyui-1.5.1/themes/icon.css">
	<script type="text/javascript" src="jsTools/jquery-easyui-1.5.1/jquery.min.js"></script>
	<script type="text/javascript" src="jsTools/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="jsTools/jquery-easyui-1.5.1/locale/easyui-lang-zh_CN.js" charset="utf-8"></script>
  </head>
  
  <body>
   	<div class="container">
   		<div class="row clearfix">
	
   				<div class="col-sm-2" >
   				
   				<ul class="list-unstyled list-inline">
   					<li><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" id="updata_information">修改个人信息</a></li>
   					<li><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="select">查看个人信息</a></li>
   					<li><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" id="updata_password">修改个人密码</a></li>
   				</ul>
				
   				</div>
   				<div class="col-sm-10">
   				<div id="divSelect">
   				<table class="table table-bordered table-hover table-condensed">
				<thead>
					
				<tbody>
					<tr>
						<td>
							用户姓名
						</td>
						<td field="name">
							
						</td>						
					</tr>
					<tr class="success">
						<td>
							用户性别
						</td>
						<td field="sex">
							
						</td>
						
					</tr>
					<tr class="error">
						<td>
							出生日期
						</td>
						<td field="birth">
							
						</td>
						
					</tr>
					<tr class="warning">
						<td>
							用户民族
						</td>
						<td field="nation">
							
						</td>
						
					</tr>
					<tr class="info">
						<td>
							用户学历
						</td>
						<td field="edu">
							
						</td>
					</tr>
					<tr class="info">
						<td>
							用户职称
						</td>
						<td field="work">
							
						</td>
					</tr>
					<tr class="info">
						<td>
							用户电话
						</td>
						<td field="phone">
							
						</td>
					</tr>
					<tr class="info">
						<td>
							家庭住址
						</td>
						<td field="place">
							
						</td>
					</tr>
					<tr class="info">
						<td>
							邮箱地址
						</td>
						<td field="email">
							
						</td>
					</tr>
				</tbody>
			</table>
   						</div>
   						<div id="divUpdata_information" >
   						<form id="oneform">
   				<table class="table table-bordered table-hover table-condensed" >
				<thead>
					
				<tbody>
					<tr>
						<td>
							用户姓名
						</td>
						<td >
							<input name="name" type="text">
						</td>						
					</tr>
					<tr class="success">
						<td>
							用户性别
						</td>
						<td>
							<input name="sex" type="text">
						</td>
						
					</tr>
					<tr class="error">
						<td>
							出生日期
						</td>
						<td >
							<input name="birth" type="text">
						</td>
						
					</tr>
					<tr class="warning">
						<td>
							用户民族
						</td>
						<td >
							<input name="nation" type="text">
						</td>
						
					</tr>
					<tr class="info">
						<td>
							用户学历
						</td>
						<td >
							<input name="edu" type="text">
						</td>
					</tr>
					<tr class="info">
						<td>
							用户职称
						</td>
						<td >
							<input name="work" type="text">
						</td>
					</tr>
					<tr class="info">
						<td>
							用户电话
						</td>
						<td >
							<input name="phone" type="text">
						</td>
					</tr>
					<tr class="info">
						<td>
							家庭住址
						</td>
						<td >
							<input name="place" type="text">
						</td>
					</tr>
					<tr class="info">
						<td>
							邮箱地址
						</td>
						<td >
							<input name="email" type="text">
						</td>
					</tr>
				</tbody>
			</table>  
			<div  class="col-sm-6 col-sm-offset-3"><button id="oneSumit"  type="button" class="btn btn-primary btn-default pull-left" ><span class=" glyphicon glyphicon-pencil"></span>修改</button>
			<button  type="reset" class="btn  btn-default pull-right">还原</button></div>  						
				</form>
				</div>
   					<div id="divUpdata_password" class="col-sm-4 col-sm-offset-4">
					 <form >
							<div style="margin-bottom:20px">
					 <input class="easyui-textbox" name="password" type="password" style="width:100%" data-options="label:'用户密码:',required:true">
							</div>
					<div style="margin-bottom:20px">
					<input class="easyui-textbox" name="topassword" type="password" style="width:100%" data-options="label:'确认密码:',required:true">			
					</div>
					<div style="text-align:center;padding:5px 0">
					<button type="button" class="easyui-linkbutton" id="p" style="width:80px">确定</button>
					<button  type="reset" class="easyui-linkbutton"  style="width:80px">清除</button>
					</div>
					</form>

   						</div>
   				</div>
   		</div>  	
   	</div>
  </body>
  <script type="text/javascript">
  $(function(){$("#divUpdata_information").css("display","none");$("#divUpdata_password").css("display","none");});
  
  	$("#select").click(function() {$("#divSelect").css("display","block");$("#divUpdata_information").css("display","none");
  	$("#divUpdata_password").css("display","none");
  	$.get("userManage!select.action",function(data){var s=JSON.parse(data);
  	 		$.each(s, function(k, v){ $("td[field="+k+"]").html(v); });} );
					});
	$("#updata_information").click(function() {$("#divSelect").css("display","none");$("#divUpdata_information").css("display","block");
	$("#divUpdata_password").css("display","none");
	$.get("userManage!select.action",function(data){var s=JSON.parse(data);
  	 		$.each(s, function(k, v){ $("input[name="+k+"]").val(v); });} );
					});
	$("#oneSumit").click(function(){var data=$("#oneform").serialize();
			$.post("userManage!updata.action",data,
				function(msg){ if(msg='true') alert("修改成功"); else alert("修改失败");
				});});				
	
	$("#updata_password").click(function() {$("#divSelect").css("display","none");$("#divUpdata_information").css("display","none");
	$("#divUpdata_password").css("display","block");
	});
	$("#p").click(function(){
		 var password=$("input[name=password]").val();var topassword=$("input[name=topassword]").val();
			if(password==topassword)
			$.post("userManage!updataPassword.action",{"password":password},function(data){ if(data=='true') alert("修改成功"); else alert("修改失败");
			});
			else
			alert("密码不一致");
			});			
	
  </script>
</html>
